#pragma once
#include "cocos2d.h"
#include "ui/CocosGUI.h"
#include "../tools/ZipArchive.h"
USING_NS_CC;

class LoadingScene : public cocos2d::Layer
{
public:
	LoadingScene();
	~LoadingScene();
	//TDXTextureSurface* GetObjs(int nUnit, int nIdx);
	// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
	virtual bool init();

	// implement the "static create()" method manually
	CREATE_FUNC(LoadingScene);
public:
	virtual void onEnter();
	virtual void onExit();

	void copyTick(float dt);
	void complete(float dt);
	void copySoundTick(float dt);
	void updateProgress(float dt);
	void updateProgressDummy(float dt);
	void singleComplete();

	bool CheckZipComplete();
	void LoadingResources();
	void refreshLoadinBar(float pr);

public:
	cocos2d::ui::Text* mLabel;
	cocos2d::ui::LoadingBar* mLoadingBar;
	cocos2d::ui::ImageView* mLoadingBarLight;
	int mCurrentProgress;
	int mCopyIndex;
	bool m_isCopyOver;
	int mSoundIndex;
	ZipArchive m_Za;
};